<template>
  <div class="query-top">
    <div class="employees-header clear">
      <div class="query-top-left">
        <i class="el-icon-search"></i>
        <span>筛选查询</span>
      </div>
      <div class="query-top-right">
        <span @click="shouqi" class="shou"
          ><i
            :class="{ 'el-icon-arrow-up': tab, 'el-icon-arrow-down': !tab }"
          ></i
          >收起筛选</span
        >
        <el-button @click="queryBtn(true)" class="top-btn">查询结果</el-button>
      </div>
    </div>
    <div class="header-from" :class="{ 'header-from1': tab }">
      <span>输入搜索：</span>
      <el-input
        placeholder="品牌名称/关键词"
        v-model="input"
        clearable
        class="button-input"
      >
      </el-input>
    </div>
  </div>
</template>

<script>
import { likeBranch } from "@/http/commodity-management/branchApi";
export default {
  name: "FilterModule",
  data() {
    return {
      tab: true,
      input: "",
      formInline: {
        user: "",
        region: "",
      },
      tableData: [],
      total: 0,
    };
  },
  methods: {
    shouqi() {
      this.tab = !this.tab;
    },
    queryBtn(bool) {
      //查询
      this.$emit("sss");
      if (bool) {
        let paramName = this.input;
        likeBranch(paramName).then((res) => {
          this.tableData = res.data.data;
          this.currentCount = res.data.data.length;
          this.$bus.$emit("table",this.tableData)
          console.log('筛选出的数量：',this.currentCount)
        });
      } else {
        this.renderPag()
      }
       this.$refs.ruleForm.resetFields();
    },
  },
};
</script>

<style lang="scss" scoped>
.query-top {
  background-color: rgba(243, 243, 243);
  border: 1px solid rgb(228, 228, 228);
  span {
    color: #666;
    size: 14px;
  }
  & .employees-header {
    height: 50px;
    line-height: 50px;
    padding: 0 20px;
    border: 1px solid rgb(217, 217, 217);
    background-color: rgb(232, 232, 232);
    border-bottom: none;
  }
  & .query-top-left {
    float: left;
  }
  & .query-top-right {
    float: right;
  }
  & .header-from {
    padding: 0 50px;
    height: 0px;
    overflow: hidden;
    transition: all 0.5s;
  }
  & .header-from1 {
    height: 50px;
  }
  & .demo-form-inline {
    margin-top: 10px;
  }
  & .shou {
    cursor: pointer;
    margin-right: 20px;
  }
  .top-btn {
    float: right;
    margin-top: 4px;
  }
  .button-input {
    width: 180px;
    line-height: 50px;
  }
}
</style>